home *** CD-ROM | disk | FTP | other *** search
/ Explorers of the New World / Explorers of the New World.iso / pc / exdata.dir / 00728_Activate-Enable-Disable Buttons.ls < prev    next >
Encoding:
Text File  |  1995-09-10  |  2.6 KB  |  99 lines

  1. on setTopicButtons
  2.   global browserTopicsLine, buttonStates, pictureButton, textButton, mapButton, printButton, pictureState, textState, mapState, printState
  3.   if browserTopicsLine = 0 then
  4.     set pictureState to 0
  5.     set textState to 0
  6.     set mapState to 0
  7.     set printState to 0
  8.   else
  9.     set oldDelimiter to the itemDelimiter
  10.     set the itemDelimiter to ":"
  11.     set buttonInfo to line browserTopicsLine of buttonStates
  12.     set pictureState to value(word 2 of item 2 of buttonInfo)
  13.     set textState to value(word 2 of item 3 of buttonInfo)
  14.     set mapState to value(word 2 of item 4 of buttonInfo)
  15.     set printState to value(word 2 of item 5 of buttonInfo)
  16.     set the itemDelimiter to oldDelimiter
  17.   end if
  18.   setButtonState(pictureState, pictureButton)
  19.   setButtonState(textState, textButton)
  20.   setButtonState(mapState, mapButton)
  21.   setButtonState(printState, printButton)
  22.   setButtonCursor(pictureState, pictureButton)
  23.   setButtonCursor(textState, textButton)
  24.   setButtonCursor(mapState, mapButton)
  25.   setButtonCursor(printState, printButton)
  26. end
  27.  
  28. on setButtonState buttonState, buttonSprite
  29.   if buttonState then
  30.     enableButton(buttonSprite)
  31.   else
  32.     disableButton(buttonSprite)
  33.   end if
  34. end
  35.  
  36. on setButtonCursor buttonState, buttonSprite
  37.   global fingerCursor
  38.   if buttonState then
  39.     set the cursor of sprite buttonSprite to fingerCursor
  40.   else
  41.     set the cursor of sprite buttonSprite to -1
  42.   end if
  43. end
  44.  
  45. on enableButton whichSprite
  46.   changeButtonCast(whichSprite, "ENABLED")
  47. end
  48.  
  49. on disableButton whichSprite
  50.   changeButtonCast(whichSprite, "DISABLED")
  51. end
  52.  
  53. on activateButtonKeepActivated whichSprite
  54.   changeButtonCast(whichSprite, "ACTIVATED")
  55.   updateStage()
  56.   repeat while not (the mouseUp)
  57.     nothing()
  58.   end repeat
  59. end
  60.  
  61. on activateButtonThenEnable whichSprite
  62.   changeButtonCast(whichSprite, "ACTIVATED")
  63.   updateStage()
  64.   repeat while not (the mouseUp)
  65.     nothing()
  66.   end repeat
  67.   changeButtonCast(whichSprite, "ENABLED")
  68. end
  69.  
  70. on changeButtonCast whichSprite, mode
  71.   set buttonType to word 1 of the name of cast the castNum of sprite whichSprite
  72.   set newCastName to buttonType && mode
  73.   set the castNum of sprite whichSprite to the number of cast newCastName
  74. end
  75.  
  76. on isActivated whichSprite
  77.   if word 2 of the name of cast the castNum of sprite whichSprite = "ACTIVATED" then
  78.     return 1
  79.   else
  80.     return 0
  81.   end if
  82. end
  83.  
  84. on isEnabled whichSprite
  85.   if word 2 of the name of cast the castNum of sprite whichSprite = "ENABLED" then
  86.     return 1
  87.   else
  88.     return 0
  89.   end if
  90. end
  91.  
  92. on isDisabled whichSprite
  93.   if word 2 of the name of cast the castNum of sprite whichSprite = "DISABLED" then
  94.     return 1
  95.   else
  96.     return 0
  97.   end if
  98. end
  99.